using System;
using Microsoft.SharePoint;

namespace SharePoint.DataMapper
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
	public class FieldMapperAttribute : Attribute
	{
		#region Constructors

		/// <summary>
		/// Field Mapper Attribute
		/// </summary>
		/// <param name="type">Field Type</param>
		public FieldMapperAttribute(Type type)
		{
			_type = type;
		}
	
		/// <summary>
		/// Field Mapper Attribute
		/// </summary>
		/// <param name="type">Field Type</param>
		/// <param name="fieldType">SPFieldType of filed</param>
		public FieldMapperAttribute(Type type, SPFieldType fieldType)
		{
			_type = type;
			_fieldType = fieldType;
		}

		#endregion

		#region Properties

		private readonly SPFieldType? _fieldType;
		/// <summary>
		/// SPFieldType of field in SharePoint.
		/// </summary>
		public SPFieldType? FieldType
		{
			get { return _fieldType; }
		}

		private readonly Type _type;
		/// <summary>
		/// Field type in SharePoint.
		/// </summary>
		public Type Type
		{
			get { return _type; }
		}

		#endregion
	}
}